package com.crm.entity;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "quotation")
public class Quotation implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(generator="increment")
	@GenericGenerator(name="increment", strategy = "increment")
	@Column(name="id")
	private int id;
	
	@ManyToOne
	@JoinColumn(name="CLIENTID")
	private Clientdet  clientid ;
	
	
	@ManyToOne
	@JoinColumn(name="ENQID")
	private Opportunity enqid ;

	private String qutdate;

	private String ordrby;

	private String quotno;

	private String remarks;
	
	private String closedesc;
	
	private double quotvalue;
	
	@OneToMany(fetch=FetchType.LAZY,cascade = CascadeType.ALL)
	@JoinColumn(name = "quotid", referencedColumnName = "id", nullable = true)
	private Set<QuotParts> quotParts ;
	
	@ManyToOne
	@JoinColumn(name="BUSINESS_ID")
	private Business businessId;
	
	public Quotation() {
		super();
	}

	public Quotation(Clientdet clientid, Opportunity enqid, String qutdate,
			String ordrby, String quotno, String remarks, String closedesc,
			Set<QuotParts> quotParts) {
		super();
		this.clientid = clientid;
		this.enqid = enqid;
		this.qutdate = qutdate;
		this.ordrby = ordrby;
		this.quotno = quotno;
		this.remarks = remarks;
		this.quotParts = quotParts;
		this.closedesc=closedesc;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}



	public Clientdet getClientid() {
		return clientid;
	}

	public void setClientid(Clientdet clientid) {
		this.clientid = clientid;
	}

	public Opportunity getEnqid() {
		return enqid;
	}

	public void setEnqid(Opportunity enqid) {
		this.enqid = enqid;
	}

	public String getQutdate() {
		return qutdate;
	}

	public void setQutdate(String qutdate) {
		this.qutdate = qutdate;
	}

	public String getOrdrby() {
		return ordrby;
	}

	public void setOrdrby(String ordrby) {
		this.ordrby = ordrby;
	}

	public String getQuotno() {
		return quotno;
	}

	public void setQuotno(String quotno) {
		this.quotno = quotno;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	//@OneToMany(mappedBy="quotation" , fetch=FetchType.LAZY)
	public Set<QuotParts> getQuotParts() {
		return quotParts;
	}

	//@OneToMany(mappedBy="quotation", fetch=FetchType.LAZY)
	public void setQuotParts(Set<QuotParts> quotParts) {
		this.quotParts = quotParts;
	}

	public Business getBusinessId() {
		return businessId;
	}

	public void setBusinessId(Business businessId) {
		this.businessId = businessId;
	}

	public String getClosedesc() {
		return closedesc;
	}

	public void setClosedesc(String closedesc) {
		this.closedesc = closedesc;
	}

	public double getQuotvalue() {
		return quotvalue;
	}

	public void setQuotvalue(double quotvalue) {
		this.quotvalue = quotvalue;
	}



	


}
